<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>

function formatType(url){
	console.warn(url)
if(!url) return false;
var index1=url.lastIndexOf(".");
var postf=url.substring(index1+1,url.length);//后缀名
console.log(isAssetTypeAnImage(postf),postf);
}


function isAssetTypeAnImage(ext) {
 const type = ['png', 'jpg', 'jpeg', 'bmp', 'gif', 'webp', 'psd', 'svg', 'tiff'];
 return {Status:type.indexOf(ext)!=-1,type:type[type.indexOf(ext)] || false};
}


formatType('https://image.uisdc.com/wp-content/uploads/2016/12/uisdc-banner-20161230-1.webp_.jpg');
// console.log();
</script>
</html>